//
//  NSString+TextHeight.m
//  JMangoClient
//
//  Created by Huy on 14/01/10.
//  Copyright 2010 JMango. All rights reserved.
//

#import "NSString+TextHeight.h"


@implementation NSString (TextHeight)

- (CGFloat)textHeightForSystemFontOfSize:(CGFloat)size AndWidth:(CGFloat)width
{
    //Calculate the expected size based on the font and linebreak mode of the label
    CGFloat maxWidth = width;
    CGFloat maxHeight = 9999;
    CGSize maximumLabelSize = CGSizeMake(maxWidth,maxHeight);
	
    CGSize expectedLabelSize = [self sizeWithFont:[UIFont systemFontOfSize:size] constrainedToSize:maximumLabelSize lineBreakMode:UILineBreakModeWordWrap]; 
	
    return expectedLabelSize.height;
}

@end
